package com.sino.operation.util;

import java.util.ArrayList;
import java.util.List;

/**
 * TOD
 *
 * @author Administrator
 * date 2021/9/15 0015 0:35
 */
public class O2OneOrListUtil {
    public static <T> List<T> castList(Object obj, Class<T> clazz)
    {
        List<T> result = new ArrayList<T>();

        if(obj instanceof List<?>)
        {
            for (Object o : (List<?>) obj)
            {
                if (o instanceof List<?>){
                    System.out.println(o.toString());
                    System.out.println(o.getClass());
                }else {
                    result.add(clazz.cast(o));
                }

            }
            return result;
        }
        return null;
    }

    public static <T> T castOne(Object obj,Class<T> clazz){
        return clazz.cast(obj);
    }
}
